![]() |
PATH![]() |
![]() ![]() |
Tell statements specify the default target, the object to which commands are sent if they do not include a direct parameter. For example, in the following Tell statement, the Close command does not include a direct parameter.
tell front window of application "AppleWorks"
close
end tell
As a result, the Close command is sent to the front window, the default target specified in the Tell statement.
When AppleScript encounters a partial reference (a reference that does not specify every container of an object), it uses the default target to complete it. For example, in the following Tell statement, the reference word 3 does not specify all of the containers of the word object, so AppleScript completes it with the default target.
tell front document of application "AppleWorks"
delete word 3 of text body
end tell
The result is that the Delete command is sent to the third word in the text body of the front document of AppleWorks.
A Tell statement also indicates which dictionary AppleScript should use to interpret words contained in the statement. For example, the previous Tell statement tells AppleScript to use the AppleWorks dictionary, which contains the definitions for the Delete command, the Word object, the Text Body object, and so on. If the Tell statement had not specified the application, AppleScript would not have understood the Delete command.